package Servlet;

import Bean.Aircraft;
import Service.AircraftService;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 张
 * Date: 2025-03-14
 * Time: 18:54
 */
//飞机的详细数据
@WebServlet("/EditAircraftServlet")
public class EditAircraftServlet extends HttpServlet {
    private AircraftService aircraftService = new AircraftService();
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        req.setCharacterEncoding("UTF-8");
        resp.setContentType("application/json;charset=utf8");

        String aircraftId = req.getParameter("aircraftId");
        Aircraft aircraft = aircraftService.selectById(aircraftId);

        req.setAttribute("aircraft",aircraft);
        req.getRequestDispatcher("aircraft_details.jsp").forward(req,resp);
    }
}
